<template>
  <div class="area_eidt_room">
    <!-- 编辑房间 -->
    <el-dialog
      :width="eidtroomataForm.roomType == 0 ?'850px':'700px'"
      custom-class="customWidth"
      center
      :before-close="roomcloseDialog"
      title="编辑房间"
      :close-on-click-modal="false"
      :visible.sync="eidtroomDialogFormVisible"
    >
      <el-form
        :model="eidtroomataForm"
        :rules="eidtroomataRule"
        ref="eidtroomataForm"
        label-width="100px"
        v-if="eidtroomDialogFormVisible"
      >
        <el-form-item label="房间信息" prop="roomName">
          <el-col :span="15" id="roominfoto">
            <el-input
              v-model="eidtroomataForm.roominfo"
              size="mini"
              style="font-size: 16px"
              disabled
            ></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="名称" prop="roomName">
          <el-col :span="15">
            <el-input v-model="eidtroomataForm.roomName" size="mini"></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="人数上限" prop="limitNum" v-if="eidtroomataForm.roomType == 0">
          <el-col :span="15">
            <el-input-number
              v-model="eidtroomataForm.limitNum"
              :min="1"
              :max="9999"
              label="描述文字"
              size="mini"
            ></el-input-number>
          </el-col>
        </el-form-item>
        <el-form-item label="网关" prop="wanguang" v-if="eidtroomataForm.roomType != 2">
          <el-col :span="15">
            <el-select
              clearable
              v-model="eidtroomataForm.wanguang"
              placeholder="请选择"
              size="mini"
              style="width: 100%"
              value-key="value"
              @change="wanguangChange"
            >
              <el-option
                v-for="item in wanguangoption"
                :key="item.value"
                :label="item.label"
                :value="item"
              ></el-option>
            </el-select>
          </el-col>
        </el-form-item>
        <!-- 网关 -->
        <el-form-item
          label="网关"
          prop="acceWanguang"
          v-show="roomType == 2  && isNewAcce(eidtroomataForm.accesscontrol)"
        >
          <el-col :span="15">
            <el-select
              clearable
              v-model="eidtroomataForm.acceWanguang"
              placeholder="请选择"
              size="mini"
              style="width: 100%"
              value-key="value"
            >
              <el-option
                v-for="item in acceWanguangOption"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-col>
        </el-form-item>
        <el-form-item label="操作" v-if="eidtroomataForm.roomType == 0">
          <el-col :span="15">
            <el-button type="primary" @click="editDialog" size="mini" icon="el-icon-plus">新增设备</el-button>
          </el-col>
        </el-form-item>
      </el-form>

      <div class="check">
        <!-- <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="eidtroomataForm.roomType == 0 ? true : false"
        >
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="70px"
            :disabled="doorlockisuseDis"
          >
            <el-form-item label-width="0px" prop="doorlockisuse">
              <el-checkbox
                v-model="eidtroomataForm.doorlockisuse"
                @change="handleChange('doorlocknumber')"
              >启用门锁</el-checkbox>
            </el-form-item>
            <el-form-item label="编号" prop="doorlocknumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.doorlocknumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="doorlocknumber">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.doorlockmodel"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                  @change="handleDoor"
                  :disabled="eidtroomataForm.doorlockisuse && eidtroomataForm.doorlockmodel != ''"
                >
                  <el-option
                    v-for="item in doorlockmodeloption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="名单格式" prop="doorlocknumber">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.nameListType"
                  placeholder="使用名单格式"
                  size="mini"
                  style="width: 100%"
                  :disabled="eidtroomataForm.doorlockisuse && eidtroomataForm.doorlockmodel != ''"
                >
                  <el-option
                    v-for="item in nameListOption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>

            <el-form-item label="参数模板" prop="doorlocktemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.doorlocktemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in doorlocktemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>-->

        <!-- <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="eidtroomataForm.roomType == 0 ? true : false"
        >
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="70px"
            :disabled="watercontrolisuseDis"
          >
            <el-form-item label-width="0px" prop="watercontrolisuse">
              <el-checkbox
                v-model="eidtroomataForm.watercontrolisuse"
                @change="handleChange('waternumber')"
              >启用水控</el-checkbox>
            </el-form-item>
            <el-form-item label="编号" prop="waternumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.waternumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="watercontrol">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.watercontrol"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in watercontroloption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="参数模板" prop="watertemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.watertemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in watertemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>-->
        <!-- 电控 -->
        <!-- <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="eidtroomataForm.roomType == 0 ? true : false"
        >
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="70px"
            :disabled="electroniccontrolisuseDis"
          >
            <el-form-item label-width="0px" prop="electroniccontrolisuse">
              <el-checkbox
                v-model="eidtroomataForm.electroniccontrolisuse"
                @change="handleChange('electroniccontrolnumber')"
              >启用电控</el-checkbox>
            </el-form-item>
            <el-form-item label="编号" prop="electroniccontrolnumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.electroniccontrolnumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="electroniccontrol">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.electroniccontrol"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in electroniccontrolopton"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="参数模板" prop="electroniccontroltemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.electroniccontroltemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in consumptiontemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>-->

        <!-- 空调 -->
        <!-- <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="eidtroomataForm.roomType == 0 ? true : false"
        >
          <el-checkbox
            v-model="eidtroomataForm.airconditioningisuse"
            @change="handleChange('airconditioningnumber')"
          >启用空调</el-checkbox>
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="70px"
          >
            <el-form-item label="编号" prop="airconditioningnumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.airconditioningnumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="airconditioning">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.airconditioning"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in airconditioningoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="参赛模板" prop="airconditioningtemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.airconditioningtemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in airconditioningtemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>-->
        <!--归属终端 -->
        <!-- <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="eidtroomataForm.roomType == 0 ? true : false"
        >
          <el-checkbox
            v-model="eidtroomataForm.terminalisuse"
            @change="handleChange('terminalnumber')"
          >启用归属终端</el-checkbox>
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="70px"
          >
            <el-form-item label="编号" prop="terminalnumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.terminalnumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="terminal">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.terminal"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in terminaloptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="参数模板" prop="terminaltemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.terminaltemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in terminaltemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>-->
        <el-table
          :data="eidtroomataForm.terminalRequests"
          border
          row-key="id"
          :header-cell-style="headFirst"
          :cell-style="(res) => headFirst_col(res, [])"
          v-if="eidtroomataForm.roomType == 0"
        >
          <el-table-column label="是否启用" prop="isUse" width="60px">
            <template slot-scope="scope">{{scope.row.isUse? '已启用':'未启用'}}</template>
          </el-table-column>
          <el-table-column label="设备名称" prop="terminalName" width="120px"></el-table-column>
          <el-table-column label="设备编号" prop="terminalCode" width="70px"></el-table-column>
          <el-table-column label="设备类型" prop="terminalType" width="70px">
            <template slot-scope="scope">{{scope.row.terminalType | terminalTypeOption}}</template>
          </el-table-column>
          <el-table-column label="设备型号" prop="terminalModel" width="90px">
            <template slot-scope="scope">{{scope.row.terminalModel | terminalModelFilter}}</template>
          </el-table-column>
          <el-table-column label="参数模板" prop="templateName" width="120px"></el-table-column>
          <el-table-column label="名单格式" prop="nameListType" width="60px">
            <template slot-scope="scope">
              <!-- 只有门锁有 terminalType-->
              {{scope.row.terminalType != 22 ?'':scope.row.nameListType | nameListTypeFilter}}
            </template>
          </el-table-column>
          <el-table-column label="所属网关" prop="controllerName" width="120px"></el-table-column>
          <el-table-column label="操作" width="80px">
            <template slot-scope="scope">
              <el-button @click="editDialog(scope.row)" type="text" size="small">编辑</el-button>
              <el-button
                type="text"
                @click.stop="deleteT(scope.row)"
                size="small"
                style="color:red"
              >删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- 消费机 -->
        <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="
            eidtroomataForm.roomType == 1 || eidtroomataForm.roomType == 3
              ? true
              : false
          "
        >
          <el-checkbox
            v-model="eidtroomataForm.consumptionisuse"
            @change="handleChange('consumptionnumber')"
          >启用消费</el-checkbox>
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="70px"
          >
            <el-form-item label="编号" prop="consumptionnumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.consumptionnumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="consumption">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.consumption"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in consumptionoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="参数模板" prop="consumptiontemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.consumptiontemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in consumptiontemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>
        <!-- 充值机 -->
        <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="eidtroomataForm.roomType == 1 ? true : false"
        >
          <el-checkbox
            v-model="eidtroomataForm.rechargeisuse"
            @change="handleChange('rechargenumber')"
          >启用充值机</el-checkbox>
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="70px"
          >
            <el-form-item label="编号" prop="rechargenumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.rechargenumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="recharge">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.recharge"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in rechargeoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="参数模板" prop="rechargetemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.rechargetemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in consumptiontemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>
        <!-- 圈存机 -->
        <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="eidtroomataForm.roomType == 1 ? true : false"
        >
          <el-checkbox
            v-model="eidtroomataForm.circlingisuse"
            @change="handleChange('circlingnumber')"
          >启用圈存机</el-checkbox>
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="70px"
          >
            <el-form-item label="编号" prop="circlingnumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.circlingnumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="circling">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.circling"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in circlingoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="参数模板" prop="circlingtemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.circlingtemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in consumptiontemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>
        <!-- 门禁 -->
        <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="eidtroomataForm.roomType == 2 ? true : false"
        >
          <el-checkbox
            v-model="eidtroomataForm.accesscontrolisuse"
            @change="handleChange('accesscontrolnumber')"
          >启用门禁</el-checkbox>
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="70px"
          >
            <el-form-item label="编号" prop="accesscontrolnumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.accesscontrolnumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="accesscontrol">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.accesscontrol"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                  @change="editBoorChage"
                  disabled
                >
                  <el-option
                    v-for="item in accesscontroloption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>

            <el-form-item label="参数模板" prop="accesscontrolemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.accesscontrolemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in accesscontroltemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item
              label="ip"
              prop="ip"
              v-show="roomType == 2  && !isNewAcce(eidtroomataForm.accesscontrol)"
            >
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.ip" size="mini"></el-input>
              </el-col>
            </el-form-item>

            <el-form-item
              label="端口"
              prop="port"
              v-show="roomType == 2  && !isNewAcce(eidtroomataForm.accesscontrol)"
            >
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.port" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <!-- 进出方向 -->
            <el-form-item
              label="进出方向"
              prop="openType"
              v-show="roomType == 2 && isNewAcce(eidtroomataForm.accesscontrol)"
            >
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.openType"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in openTypeOption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <!-- 门编号 -->
            <el-form-item
              label="门编号"
              prop="doorCode"
              v-show="roomType == 2 && isNewAcce(eidtroomataForm.accesscontrol)"
            >
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.doorCode"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                  disabled
                >
                  <el-option v-for="item in 2" :key="item" :label="item" :value="item"></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <!-- 门禁ip -->
            <el-form-item
              label="人脸机ip"
              prop="doorFaceIp"
              v-show="roomType == 2 && isNewAcce(eidtroomataForm.accesscontrol)"
            >
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.doorFaceIp" size="mini"></el-input>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>

        <!-- 无人售货 -->
        <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="eidtroomataForm.roomType == 4 ? true : false"
        >
          <el-checkbox
            v-model="eidtroomataForm.unsoldisuse"
            @change="handleChange('unsoldnumber')"
          >启用无人售货</el-checkbox>
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="100px"
          >
            <el-form-item label="编号" prop="unsoldnumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.unsoldnumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="unsold">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.unsold"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in unsoldoptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="参数模板" prop="unsoldtemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.unsoldtemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in unsoldtemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>
        <!-- 直饮水 -->
        <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="eidtroomataForm.roomType == 4 ? true : false"
        >
          <el-checkbox
            v-model="eidtroomataForm.drinkingwaterisuse"
            @change="handleChange('drinkingwaternumber')"
          >启用直饮水</el-checkbox>
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="100px"
          >
            <el-form-item label="编号" prop="drinkingwaternumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.drinkingwaternumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="drinkingwater">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.drinkingwater"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in drinkingwateroptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="参数模板" prop="drinkingwatertemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.drinkingwatertemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in drinkingwatertemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>
        <!-- 电吹风 -->
        <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="eidtroomataForm.roomType == 4 ? true : false"
        >
          <el-checkbox
            v-model="eidtroomataForm.hairdryerisuse"
            @change="handleChange('hairdryernumber')"
          >启用电吹风</el-checkbox>
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="100px"
          >
            <el-form-item label="编号" prop="hairdryernumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.hairdryernumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="hairdryer">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.hairdryer"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in hairdryeroption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="参数模板" prop="hairdryertemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.hairdryertemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in hairdryertemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>
        <!-- 公话 -->
        <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="eidtroomataForm.roomType == 4 ? true : false"
        >
          <el-checkbox
            v-model="eidtroomataForm.voiperisuse"
            @change="handleChange('voipernumber')"
          >启用公话</el-checkbox>
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="100px"
          >
            <el-form-item label="编号" prop="voipernumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.voipernumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="voiper">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.voiper"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in voiperoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="参数模板" prop="voipertemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.voipertemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in voipertemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>
        <!-- 发卡机 -->
        <el-card
          class="box-card"
          style="width: 45%"
          shadow="hover"
          v-if="eidtroomataForm.roomType == 4 ? true : false"
        >
          <el-checkbox
            v-model="eidtroomataForm.sendcardserisuse"
            @change="handleChange('sendcardsernumber')"
          >启用发卡机</el-checkbox>
          <el-form
            :model="eidtroomataForm"
            :rules="eidtroomataRule"
            ref="eidtroomataForm"
            label-width="100px"
          >
            <el-form-item label="编号" prop="sendcardsernumber">
              <el-col :span="18">
                <el-input v-model="eidtroomataForm.sendcardsernumber" size="mini"></el-input>
              </el-col>
            </el-form-item>
            <el-form-item label="型号" prop="sendcardser">
              <el-col :span="18">
                <el-select
                  v-model="eidtroomataForm.sendcardser"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in sendcardseroption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
            <el-form-item label="参数模板" prop="sendcardsertemplate">
              <el-col :span="18">
                <el-select
                  clearable
                  v-model="eidtroomataForm.sendcardsertemplate"
                  placeholder="请选择"
                  size="mini"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in sendcardsertemplateoption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-col>
            </el-form-item>
          </el-form>
        </el-card>
      </div>

      <span slot="footer" class="dialog-footer">
        <el-button @click="eidtroomvisible()">取消</el-button>
        <el-button type="primary" @click="eidtroomataFormSubmit()">确定</el-button>
      </span>
    </el-dialog>
    <div class="edit">
      <!-- 编辑设备 -->
      <el-dialog
        width="500px"
        custom-class="edit"
        center
        :before-close="editcloseDialog"
        :title="editTTitle"
        :close-on-click-modal="false"
        :visible.sync="editTVisible"
        append-to-body
      >
        <el-form :model="editTForm" :rules="editTRule" ref="eidtForm" label-width="80px">
          <el-form-item label="设备名称" prop="terminalName" v-if="editTTitle!='新增设备'">
            <el-col :span="15">
              <el-input v-model="editTForm.terminalName" size="mini"></el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="设备编号" prop="terminalCode" v-if="editTTitle!='新增设备'">
            <el-col :span="15">
              <el-input v-model="editTForm.terminalCode" size="mini"></el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="网关" prop="wanguang">
            <el-col :span="15">
              <el-select
                clearable
                v-model="editTForm.wanguang"
                placeholder="请选择"
                size="mini"
                style="width: 100%"
                value-key="value"
                @change="(res) => editWangChange(res, editTForm.terminalType)"
              >
                <el-option
                  v-for="item in wanguangoption"
                  :key="item.value"
                  :label="item.label"
                  :value="item"
                ></el-option>
              </el-select>
            </el-col>
          </el-form-item>
          <el-form-item label="设备类型" prop="terminalType">
            <el-col :span="15">
              <el-select
                clearable
                v-model="editTForm.terminalType"
                placeholder="设备类型"
                size="mini"
                value-key="value"
                @change="editTSelect"
                :disabled="editTTitle!='新增设备'"
              >
                <el-option
                  v-for="item in terminalTypeOpiton"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-col>
          </el-form-item>
          <el-form-item label="设备型号" prop="terminalModel">
            <el-col :span="15">
              <el-select
                v-model="editTForm.terminalModel"
                placeholder="选择设备型号"
                size="mini"
                style="width: 100%"
                @change="res =>handleDoor(res, true, editTForm.terminalType)"
              >
                <el-option
                  v-for="item in terminalModelOpiton"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-col>
          </el-form-item>
          <el-form-item label="数量" prop="addNumber" v-if="editTTitle=='新增设备'">
            <el-col :span="15">
              <el-input-number
                v-model="editTForm.addNumber"
                :min="1"
                size="mini"
                style="width:100%"
              ></el-input-number>
            </el-col>
          </el-form-item>
          <el-form-item label="参数模板" prop="templateGuid">
            <el-col :span="15">
              <el-select
                clearable
                v-model="editTForm.templateGuid"
                placeholder="参数模板"
                size="mini"
                style="width: 100%"
              >
                <el-option
                  v-for="item in templateGuidOpiton"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-col>
          </el-form-item>
          <el-form-item label="名单格式" prop="nameListType" v-show="editTForm.terminalType == 22">
            <el-col :span="15">
              <el-select
                v-model="editTForm.nameListType"
                placeholder="名单格式"
                size="mini"
                style="width: 100%"
              >
                <el-option
                  v-for="item in nameListOption"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-col>
          </el-form-item>
          <el-form-item label="是否启用" prop="isUse">
            <el-checkbox v-model="editTForm.isUse"></el-checkbox>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="editcloseDialog">取消</el-button>
          <el-button type="primary" @click="eidtFormSubmit" v-if="editTTitle!='新增设备'">确定</el-button>
          <el-button type="primary" @click="addFormSubmit" v-if="editTTitle=='新增设备'">确定</el-button>
        </span>
      </el-dialog>
    </div>
  </div>
</template>

<script>
let _thisBuild
export default {
  data() {
    return {
      // 楼栋编号
      buildingCode: '',
      // 门锁多选框
      doorlockisuseDis: false,
      // 电控多选框
      electroniccontrolisuseDis: false,
      // 水控
      watercontrolisuseDis: false,
      // 房间号码
      roomNumber: '',
      eidtroomDialogFormVisible: false,
      buildingGuid: '',
      layers: '',
      areaGuid: '',
      roomGuid: '',
      terminalRequests: [],

      wanguangoption: [],

      doorlockmodeloption: [],
      doorlocktemplateoption: [],

      watercontroloption: [],
      watertemplateoption: [],
      // 无人售货
      unsoldoptions: [],
      unsoldtemplateoption: [],
      //直饮水
      drinkingwateroptions: [
        {
          value: 59,
          label: 'F662CW'
        },
        {
          value: 51,
          label: 'F600CW'
        },
        {
          value: 56,
          label: 'F562CW'
        },
        {
          value: 50,
          label: 'F500CW'
        }
      ],
      drinkingwatertemplateoption: [],
      //电吹风
      hairdryeroption: [],
      hairdryertemplateoption: [],

      // 公话
      voiperoption: [],
      voipertemplateoption: [],
      // 发卡机
      sendcardseroption: [],
      sendcardsertemplateoption: [],
      // 电控
      electroniccontrolopton: [],
      electroniccontroltemplateoption: [],

      //空调
      airconditioningoption: [],
      airconditioningtemplateoption: [],
      //归属终端
      terminaloptions: [],
      terminaltemplateoption: [],
      // 消费
      consumptionoption: [],
      consumptiontemplateoption: [],
      // 充值机
      rechargeoption: [],
      // 圈存机
      circlingoption: [],
      // 门禁
      accesscontroloption: [],
      accesscontroltemplateoption: [],
      // 门锁-名单格式
      nameListOption: [],
      // 房间类型为 0 的，设备型号
      roomEquipmentType: [],
      eidtroomataForm: {
        terminalRequests: [],
        // 最大可住人数
        limitNum: '',
        roominfo: '',
        roomName: '',
        wanguang: [],
        roomType: 0,
        roomCode: '',
        //电吹风
        hairdryer: '',
        hairdryernumber: '',
        hairdryerpkTerminalId: '',
        hairdryertemplate: '',
        // 公话
        voiper: '',
        voipernumber: '',
        voiperpkTerminalId: '',
        voipertemplate: '',
        // 发卡机
        sendcardser: '',
        sendcardsernumber: '',
        sendcardserpkTerminalId: '',
        sendcardsertemplate: '',
        //直饮水
        drinkingwater: '',
        drinkingwaternumber: '',
        drinkingwatertemplate: '',
        drinkingwaterpkTerminalId: '',
        //无人售货
        unsold: '',
        unsoldnumber: '',
        unsoldpkTerminalId: '',
        unsoldtemplate: '',
        // 归属终端
        terminal: '',
        terminalnumber: '',
        terminaltemplate: '',
        terminalpkTerminalId: '',
        //空调
        airconditioning: '',
        airconditioningnumber: '',
        airconditioningtemplate: '',
        airconditioningpkTerminalId: '',
        //电控
        electroniccontrol: '',
        electroniccontrolnumber: '',
        electroniccontroltemplate: '',
        electroniccontrolpkTerminalId: '',
        //门锁
        doorlocknumber: '',
        // 名单格式
        nameListType: '',
        doorlockmodel: '',
        doorlocktemplate: '',
        doorpkTerminalId: '',
        //水控
        waterpkTerminalId: '',
        waternumber: '',
        watercontrol: '',
        watertemplate: '',
        //消费
        consumptionnumber: '',
        consumption: '',
        consumptiontemplate: '',
        consumptionpkTerminalId: '',
        consumptionisuse: false,
        // 充值机
        rechargenumber: '',
        recharge: '',
        rechargetemplate: '',
        rechargepkTerminalId: '',
        rechargeisuse: false,
        // 圈存机
        circlingnumber: '',
        circling: '',
        circlingtemplate: '',
        circlingpkTerminalId: '',
        circlingisuse: false,
        //门禁
        accesscontrol: '',
        accesscontrolnumber: '',
        accesscontrolemplate: '',
        accesscontrolpkTerminalId: '',
        // ip/端口
        ip: '',
        port: '',
        // 门禁网关
        acceWanguang: '',
        doorFaceIp: '',
        openType: '',

        doorlockisuse: false,
        watercontrolisuse: false,
        electroniccontrolisuse: false,
        airconditioningisuse: false,
        terminalisuse: false,

        accesscontrolisuse: false,

        unsoldisuse: false,
        drinkingwaterisuse: false,
        // 电吹风
        hairdryerisuse: false,
        // 公话
        voiperisuse: false,
        // 发卡机
        sendcardserisuse: false
      },
      eidtroomataRule: {},
      /**门禁处理 {modelId: 70,modelName: "A1262T"}*/
      // 新的门禁类型
      newAccesscontrol: [70],
      // 门禁网关
      acceWanguangOption: [],
      // 进出方向
      openTypeOption: [
        { label: '进门', value: 0 },
        { label: '出门', value: 1 }
      ],
      /**
       * 编辑设备
       */
      // 设备类型
      terminalTypeOpiton: [
        // { value: '1', label: '消费机' },
        // { value: '2', label: '充值机' },
        { value: 6, label: '水控' },
        // { value: '21', label: '门禁' },
        { value: 22, label: '电子门锁' },
        // { value: '23', label: '多门门禁' },
        { value: 31, label: '电控' },
        { value: 24, label: '空调' },
        { value: 25, label: '归宿终端' }
        // { value: '26', label: '无人售货机' },
        // { value: '27', label: '直饮水机' },
        // { value: '28', label: '电吹风' },
        // { value: '29', label: '发卡机' },
        // { value: '30', label: '中继' },
        // { value: '32', label: '公话' },
        // { value: '255', label: '控制器' }
      ],
      // 设备型号
      terminalModelOpiton: [],
      // 参数模板
      templateGuidOpiton: [],
      editTVisible: false,
      editTTitle: '新增设备',
      editTForm: {
        // 设备类型
        terminalType: '',
        terminalName: '',
        terminalCode: '',
        // 设备id
        terminalGuid: '',
        // 设备型号
        terminalModel: '',
        // 参数模板id
        templateGuid: '',
        wanguang: '',
        addNumber: 1,
        nameListType: '',
        isUse: true
      },
      editTRule: {
        terminalType: [
          { required: true, message: '请选择设备类型', trigger: 'blur' }
        ],
        terminalModel: [
          { required: true, message: '请选择设备型号', trigger: 'blur' }
        ]
        // addNumber: [{ required: true, message: '请输入数量', trigger: 'blur' }]
      }
    }
  },
  computed: {
    updateDocumentClientHeight: {
      get() {
        return this.$store.state.common.updateDocumentClientHeight
      }
    }
  },
  beforeCreate() {
    _thisBuild = this
  },
  mounted() {
    console.log(this.updateDocumentClientHeight)
  },
  props: ['unitGuid'],
  filters: {
    nameListTypeFilter(val) {
      if (val == 1) {
        return '16字节'
      } else if (val == 2) {
        return '32字节'
      } else {
        return '—'
      }
    },
    terminalModelFilter(val) {
      let arr = _thisBuild.roomEquipmentType.filter(item => val == item.value)
      return arr.length != 0 ? arr[0].label : ''
    }
  },
  methods: {
    /**
     * 门禁处理
     */
    // 判断是否存在
    isNewAcce(newAcce) {
      return this.newAccesscontrol.includes(newAcce)
    },
    // 获取门禁网关
    getAceeWangguan(val) {
      this.eidtroomataForm.acceWanguang = ''
      this.$http({
        url: this.$http.adornUrl('/api/v1/device/controller-entrance-pithy'),
        method: 'post',
        data: this.$http.adornData({
          messageContent: {
            buildingGuid: this.buildingGuid,
            layer: this.layers,
            controllerModel: val
          },
          messageType: 0
        })
      }).then(({ data }) => {
        if (data.messageCode == 200) {
          let Arr = data.messageContent
          this.acceWanguangOption = []
          for (var i = 0; i < Arr.length; i++) {
            var itemObj = {
              label: Arr[i].controllerName,
              value: Arr[i].controllerGuid,
              type: 21
            }
            this.acceWanguangOption.push(itemObj)
          }
        } else {
          this.$message.error(data.errorMessage)
        }
      })
    },
    /**
     * 门锁处理
     */
    // 门锁名单使用格式
    handleDoor(val, is = true, type) {
      if (type == 22) {
        if (val == 45) {
          this.nameListOption = [
            { value: 1, label: '16字节' },
            { value: 2, label: '32字节' }
          ]
          if (is) {
            this.eidtroomataForm.nameListType = 1
            this.editTForm.nameListType = 1
          }
        } else if (val == 46 || val == 49) {
          this.nameListOption = [{ value: 1, label: '16字节' }]
          if (is) {
            this.eidtroomataForm.nameListType = 1
            this.editTForm.nameListType = 1
          }
        } else if (val == 47 || val == 48 || val == 43) {
          this.nameListOption = [{ value: 2, label: '32字节' }]
          if (is) {
            this.eidtroomataForm.nameListType = 2
            this.editTForm.nameListType = 2
          }
        }
      }
    },
    // 网关选择
    wanguangChange(val) {
      console.log(val)
      // this.doorlockisuseDis= true
      // 房间
      if (this.roomType == 0) {
        // this.eidtroomataForm.doorlockmodel = '';
        // this.eidtroomataForm.watercontrol = '';
        // this.eidtroomataForm.electroniccontrol = '';
        // doorlockisuse,watercontrolisuse,electroniccontrolisuse
        // MC3611	91	MC3612	92 CT1601	93 CT1612	95	MC3622	96	MC3632	98
        if (val.controllerModel == 91 || val.controllerModel == 92) {
          // 门锁
          this.doorlockmodeloption = [
            { value: 43, label: 'EL200CW' },
            { value: 45, label: 'EL150CW' },
            { value: 48, label: 'EL300CW' },
            { value: 49, label: 'EL180CW' }
          ]
          // 水控
          this.watercontroloption = [
            { value: 32, label: 'F300CW' },
            { value: 50, label: 'F500CW' },
            { value: 51, label: 'F600CW' }
          ]

          this.doorlockisuseDis = false
          this.electroniccontrolisuseDis = true
          this.watercontrolisuseDis = false
          // 是否启用
          this.$set(this.eidtroomataForm, 'electroniccontrolisuse', false)

          this.electroniccontrolopton = []
        } else if (val.controllerModel == 96) {
          // 门锁
          this.doorlockmodeloption = [
            { value: 43, label: 'EL200CW' },
            { value: 45, label: 'EL150CW' },
            { value: 48, label: 'EL300CW' },
            { value: 49, label: 'EL180CW' }
          ]
          // 水控
          this.watercontroloption = [
            { value: 56, label: 'F562CW' },
            { value: 59, label: 'F662CW' }
          ]

          this.doorlockisuseDis = false
          this.electroniccontrolisuseDis = true
          this.watercontrolisuseDis = false
          // 是否启用
          this.$set(this.eidtroomataForm, 'electroniccontrolisuse', false)

          // 电控
          this.electroniccontrolopton = []
        } else if (val.controllerModel == 98) {
          // 门锁
          this.doorlockmodeloption = [
            { value: 43, label: 'EL200CW' },
            { value: 45, label: 'EL150CW' },
            { value: 46, label: 'EL150C-A' },
            { value: 47, label: 'EL150C-B' },
            { value: 48, label: 'EL300CW' },
            { value: 49, label: 'EL180CW' }
          ]
          // 水控
          this.watercontroloption = [
            { value: 56, label: 'F562CW' },
            { value: 59, label: 'F662CW' }
          ]

          this.doorlockisuseDis = false
          this.electroniccontrolisuseDis = true
          this.watercontrolisuseDis = false
          // 是否启用
          this.$set(this.eidtroomataForm, 'electroniccontrolisuse', false)
        } else if (val.controllerModel == 93 || val.controllerModel == 95) {
          // 门锁
          this.doorlockmodeloption = [
            { value: 46, label: 'EL150C-A' },
            { value: 47, label: 'EL150C-B' }
          ]
          this.doorlockisuseDis = false
          this.electroniccontrolisuseDis = true
          this.watercontrolisuseDis = true
          // 是否启用
          this.$set(this.eidtroomataForm, 'electroniccontrolisuse', false)
          this.$set(this.eidtroomataForm, 'watercontrolisuse', false)

          this.watercontroloption = []
          this.electroniccontrolopton = []
        } else if (val.controllerModel == 97) {
          this.doorlockisuseDis = true
          this.electroniccontrolisuseDis = false
          this.watercontrolisuseDis = true
          // 电控
          this.electroniccontrolopton = [{ value: 71, label: 'EC100' }]
          // 是否启用
          this.$set(this.eidtroomataForm, 'doorlockisuse', false)
          this.$set(this.eidtroomataForm, 'watercontrolisuse', false)

          this.watercontroloption = []
          this.doorlockmodeloption = []
        } else {
          // 门锁
          this.doorlockmodeloption = [
            { value: 43, label: 'EL200CW' },
            { value: 45, label: 'EL150CW' },
            { value: 46, label: 'EL150C-A' },
            { value: 47, label: 'EL150C-B' },
            { value: 48, label: 'EL300CW' },
            { value: 49, label: 'EL180CW' }
          ]
          // 水控
          this.watercontroloption = [
            { value: 32, label: 'F300CW' },
            { value: 50, label: 'F500CW' },
            { value: 51, label: 'F600CW' },
            { value: 56, label: 'F562CW' },
            { value: 59, label: 'F662CW' }
          ]
          // 电控
          this.electroniccontrolopton = [{ value: 71, label: 'EC100' }]
        }
        // 空调
        this.airconditioningoption = [{ value: 125, label: 'KongTiao' }]
        // 归宿终端
        this.hometerminaloption = [{ value: 130, label: 'GuiSuZhongDuan' }]
      }
      // 食堂、小卖部
      if (this.roomType == 1 || this.roomType == 3) {
        this.eidtroomataForm.consumption = ''
        this.eidtroomataForm.recharge = ''
        this.rechargeoption = []
        this.circlingoption = []
        // 消费机
        if (val.controllerModel == 91 || val.controllerModel == 92) {
          // 消费
          this.consumptionoption = [
            { value: 53, label: 'S810CW' },
            { value: 55, label: 'S910CW' }
          ]
        } else if (val.controllerModel == 96 || val.controllerModel == 98) {
          // 消费
          this.consumptionoption = [
            { value: 57, label: 'S862CW' },
            { value: 58, label: 'S962CW' },
            { value: 65, label: 'S863CW' },
            { value: 66, label: 'S963CW' }
            // { value: 61, label: "S962CW_CZ" },
          ]
          this.rechargeoption = [
            { value: 61, label: 'S962CW_CZ' },
            { value: 67, label: 'S963CW_CZ' }
          ]
          this.circlingoption = [{ value: 68, label: 'S963CW-QC' }]
        } else {
          // 消费
          this.consumptionoption = [
            { value: 53, label: 'S810CW' },
            { value: 55, label: 'S910CW' },
            { value: 57, label: 'S862CW' },
            { value: 58, label: 'S962CW' },
            { value: 65, label: 'S863CW' },
            { value: 66, label: 'S963CW' }
            // { value: 61, label: "S962CW_CZ" },
          ]
          this.rechargeoption = [
            { value: 61, label: 'S962CW_CZ' },
            { value: 67, label: 'S963CW_CZ' }
          ]
          this.circlingoption = [{ value: 68, label: 'S963CW-QC' }]
        }
      }
      // 公共场所
      if (this.roomType == 4) {
        this.eidtroomataForm.drinkingwater = ''
        if (val.controllerModel == 91 || val.controllerModel == 92) {
          // 直饮水
          this.drinkingwateroptions = [
            { value: 32, label: 'F300CW' },
            { value: 50, label: 'F500CW' },
            { value: 51, label: 'F600CW' }
          ]
        } else if (val.controllerModel == 96 || val.controllerModel == 98) {
          // 直饮水
          this.drinkingwateroptions = [
            { value: 56, label: 'F562CW' },
            { value: 59, label: 'F662CW' }
          ]
        } else {
          // 直饮水
          this.drinkingwateroptions = [
            { value: 32, label: 'F300CW' },
            { value: 50, label: 'F500CW' },
            { value: 51, label: 'F600CW' },
            { value: 56, label: 'F562CW' },
            { value: 59, label: 'F662CW' }
          ]
        }
      }
    },
    handleChange(val) {
      console.log(this.eidtroomataForm[val])
      if (!this.eidtroomataForm[val]) {
        this.eidtroomataForm[val] = this.buildingCode + this.roomNumber
      }
    },
    editBoorChage(val) {
      console.log(val)
      if (
        this.eidtroomataForm.accesscontrol == '13' ||
        this.eidtroomataForm.accesscontrol == '15'
      ) {
        this.terminaltemplate(21, this.accesscontroltemplateoption)
      } else {
        this.terminaltemplate(23, this.accesscontroltemplateoption)
      }
    },

    roomcloseDialog(done) {
      // if (this.$refs['eidtroomataForm']!==undefined) {
      //   this.$refs['eidtroomataForm'].resetFields()
      // }
      this.eidtroomataForm.nameListType = ''
      done()
    },
    eidtroomvisible() {
      this.eidtroomataForm.nameListType = ''
      this.eidtroomDialogFormVisible = false
      // this.$refs["eidtroomataForm"].resetFields();
    },
    eidtroomataFormSubmit() {
      this.terminalRequests = []
      // console.log(this.areaGuid)
      // console.log(this.buildingGuid)
      // console.log(this.eidtroomataForm.wanguang)
      // console.log(this.layers)
      // console.log(this.roomGuid)
      // console.log(this.unitGuid)
      if (this.roomType == 0) {
        // if (this.eidtroomataForm.doorlockisuse == true) {
        //   if (
        //     this.eidtroomataForm.doorlockmodel != '' &&
        //     this.eidtroomataForm.nameListType == ''
        //   ) {
        //     this.$message({
        //       message: '门锁数据不合法',
        //       type: 'warning'
        //     })
        //     return
        //   }
        //   if (
        //     this.eidtroomataForm.doorlocknumber == '' ||
        //     this.eidtroomataForm.doorlockmodel == ''
        //   ) {
        //     this.$message({
        //       message: '门锁数据不合法',
        //       type: 'warning'
        //     })
        //     return
        //   }
        // }
        // if (this.eidtroomataForm.watercontrolisuse == true) {
        //   if (
        //     this.eidtroomataForm.waternumber == '' ||
        //     this.eidtroomataForm.watercontrol == ''
        //   ) {
        //     this.$message({
        //       message: '水控数据不合法',
        //       type: 'warning'
        //     })
        //     return
        //   }
        // }
        // if (this.eidtroomataForm.electroniccontrolisuse == true) {
        //   if (
        //     this.eidtroomataForm.electroniccontrolnumber == '' ||
        //     this.eidtroomataForm.electroniccontrol == ''
        //   ) {
        //     this.$message({
        //       message: '电控数据不合法',
        //       type: 'warning'
        //     })
        //     return
        //   }
        // }
        // if (this.eidtroomataForm.airconditioningisuse == true) {
        //   if (
        //     this.eidtroomataForm.airconditioningnumber == '' ||
        //     this.eidtroomataForm.airconditioning == ''
        //   ) {
        //     this.$message({
        //       message: '空调数据不合法',
        //       type: 'warning'
        //     })
        //     return
        //   }
        // }
        // if (this.eidtroomataForm.terminalisuse == true) {
        //   if (
        //     this.eidtroomataForm.terminalnumber == '' ||
        //     this.eidtroomataForm.terminal == ''
        //   ) {
        //     this.$message({
        //       message: '归宿终端数据不合法',
        //       type: 'warning'
        //     })
        //     return
        //   }
        // }
        // if (
        //   this.eidtroomataForm.doorpkTerminalId !== '' ||
        //   this.eidtroomataForm.doorlockisuse
        // ) {
        //   this.terminalRequests.push({
        //     isUse: this.eidtroomataForm.doorlockisuse == true ? 1 : 0,
        //     pkTerminalId: this.eidtroomataForm.doorpkTerminalId,
        //     terminalType: 22,
        //     terminalModel: this.eidtroomataForm.doorlockmodel,
        //     templateGuid: this.eidtroomataForm.doorlocktemplate,
        //     nameListType: this.eidtroomataForm.nameListType,
        //     terminalCode: this.eidtroomataForm.doorlocknumber
        //   })
        // }
        // if (
        //   this.eidtroomataForm.waterpkTerminalId !== '' ||
        //   this.eidtroomataForm.watercontrolisuse
        // ) {
        //   this.terminalRequests.push({
        //     isUse: this.eidtroomataForm.watercontrolisuse == true ? 1 : 0,
        //     pkTerminalId: this.eidtroomataForm.waterpkTerminalId,
        //     terminalType: 6,
        //     terminalModel: this.eidtroomataForm.watercontrol,
        //     templateGuid: this.eidtroomataForm.watertemplate,
        //     terminalCode: this.eidtroomataForm.waternumber
        //   })
        // }
        // if (
        //   this.eidtroomataForm.electroniccontrol !== '' ||
        //   this.eidtroomataForm.electroniccontrolisuse
        // ) {
        //   this.terminalRequests.push({
        //     isUse: this.eidtroomataForm.electroniccontrolisuse == true ? 1 : 0,
        //     pkTerminalId: this.eidtroomataForm.electroniccontrolpkTerminalId,
        //     terminalType: 31,
        //     terminalModel: this.eidtroomataForm.electroniccontrol,
        //     templateGuid: this.eidtroomataForm.doorlocktemplate,
        //     terminalCode: this.eidtroomataForm.electroniccontrolnumber
        //   })
        // }
        // if (
        //   this.eidtroomataForm.airconditioningpkTerminalId !== '' ||
        //   this.eidtroomataForm.airconditioningisuse
        // ) {
        //   this.terminalRequests.push({
        //     isUse: this.eidtroomataForm.airconditioningisuse == true ? 1 : 0,
        //     pkTerminalId: this.eidtroomataForm.airconditioningpkTerminalId,
        //     terminalType: 24,
        //     terminalModel: this.eidtroomataForm.airconditioning,
        //     templateGuid: this.eidtroomataForm.electroniccontroltemplate,
        //     terminalCode: this.eidtroomataForm.airconditioningnumber
        //   })
        // }
        // if (
        //   this.eidtroomataForm.terminalpkTerminalId !== '' ||
        //   this.eidtroomataForm.terminalisuse
        // ) {
        //   this.terminalRequests.push({
        //     isUse: this.eidtroomataForm.terminalisuse == true ? 1 : 0,
        //     pkTerminalId: this.eidtroomataForm.terminalpkTerminalId,
        //     terminalType: 25,
        //     terminalModel: this.eidtroomataForm.terminal,
        //     templateGuid: this.eidtroomataForm.terminaltemplate,
        //     terminalCode: this.eidtroomataForm.terminalnumber
        //   })
        // }
      }
      if (this.roomType == 2) {
        if (this.eidtroomataForm.accesscontrolisuse == true) {
          if (
            this.eidtroomataForm.accesscontrol == '' ||
            this.eidtroomataForm.accesscontrolnumber == ''
          ) {
            this.$message({
              message: '门禁数据不合法',
              type: 'warning'
            })
            return
          }
        }
        if (
          this.eidtroomataForm.accesscontrolpkTerminalId !== '' ||
          this.eidtroomataForm.accesscontrolisuse
        ) {
          let portReg = /^((25[0-5]|2[0-4]\d|[01]?\d\d?)($|(?!\.$)\.)){4}$/
          // 判断是否是新门禁
          if (this.isNewAcce(this.eidtroomataForm.accesscontrol)) {
            if (this.eidtroomataForm.doorFaceIp != '') {
              if (!portReg.test(this.eidtroomataForm.doorFaceIp)) {
                this.$message.error('人脸机ip格式不正确')
                return
              }
            }
            this.terminalRequests.push({
              isUse: this.eidtroomataForm.accesscontrolisuse == true ? 1 : 0,
              pkTerminalId: this.eidtroomataForm.accesscontrolpkTerminalId,
              terminalType: 21,
              terminalModel: this.eidtroomataForm.accesscontrol,
              templateGuid: this.eidtroomataForm.accesscontrolemplate,
              terminalCode: this.eidtroomataForm.accesscontrolnumber,
              doorCode: this.eidtroomataForm.doorCode,
              doorFaceIp: this.eidtroomataForm.doorFaceIp,
              openType: this.eidtroomataForm.openType
            })
          } else {
            if (
              this.eidtroomataForm.ip === '' ||
              this.eidtroomataForm.port === ''
            ) {
              this.$message.error('ip、端口必须填写')
              return
            }
            this.terminalRequests.push({
              isUse: this.eidtroomataForm.accesscontrolisuse == true ? 1 : 0,
              pkTerminalId: this.eidtroomataForm.accesscontrolpkTerminalId,
              terminalType: 21,
              terminalModel: this.eidtroomataForm.accesscontrol,
              templateGuid: this.eidtroomataForm.accesscontrolemplate,
              terminalCode: this.eidtroomataForm.accesscontrolnumber,
              ip: this.eidtroomataForm.ip,
              port: this.eidtroomataForm.port
            })
          }
        }
      }
      if (this.roomType == 1 || this.roomType == 3) {
        if (this.eidtroomataForm.consumptionisuse == true) {
          if (
            this.eidtroomataForm.consumption == '' ||
            this.eidtroomataForm.consumptionnumber == ''
          ) {
            this.$message({
              message: '消费机数据不合法',
              type: 'warning'
            })
            return
          }
        }

        if (this.eidtroomataForm.rechargeisuse == true) {
          if (
            this.eidtroomataForm.recharge == '' ||
            this.eidtroomataForm.rechargenumber == ''
          ) {
            this.$message({
              message: '充值机数据不合法',
              type: 'warning'
            })
            return
          }
        }
        if (this.eidtroomataForm.circlingisuse == true) {
          if (
            this.eidtroomataForm.circling == '' ||
            this.eidtroomataForm.circlingnumber == ''
          ) {
            this.$message({
              message: '圈存机数据不合法',
              type: 'warning'
            })
            return
          }
        }
        if (
          this.eidtroomataForm.consumptionpkTerminalId !== '' ||
          this.eidtroomataForm.consumptionisuse
        ) {
          this.terminalRequests.push({
            isUse: this.eidtroomataForm.consumptionisuse == true ? 1 : 0,
            pkTerminalId: this.eidtroomataForm.consumptionpkTerminalId,
            terminalType: 1,
            terminalModel: this.eidtroomataForm.consumption,
            templateGuid: this.eidtroomataForm.consumptiontemplate,
            terminalCode: this.eidtroomataForm.consumptionnumber
          })
        }
        if (
          this.eidtroomataForm.rechargepkTerminalId !== '' ||
          this.eidtroomataForm.rechargeisuse
        ) {
          this.terminalRequests.push({
            isUse: this.eidtroomataForm.rechargeisuse == true ? 1 : 0,
            pkTerminalId: this.eidtroomataForm.rechargepkTerminalId,
            terminalType: 2,
            terminalModel: this.eidtroomataForm.recharge,
            templateGuid: this.eidtroomataForm.rechargetemplate,
            terminalCode: this.eidtroomataForm.rechargenumber
          })
        }
        // 圈存机
        if (
          this.eidtroomataForm.circlingpkTerminalId !== '' ||
          this.eidtroomataForm.circlingisuse
        ) {
          this.terminalRequests.push({
            isUse: this.eidtroomataForm.circlingisuse == true ? 1 : 0,
            pkTerminalId: this.eidtroomataForm.circlingpkTerminalId,
            terminalType: 33,
            terminalModel: this.eidtroomataForm.circling,
            templateGuid: this.eidtroomataForm.circlingtemplate,
            terminalCode: this.eidtroomataForm.circlingnumber
          })
        }
      }
      if (this.roomType == 4) {
        if (this.eidtroomataForm.unsoldisuse == true) {
          if (
            this.eidtroomataForm.unsold == '' ||
            this.eidtroomataForm.unsoldnumber == ''
          ) {
            this.$message({
              message: '无人售货机数据不合法',
              type: 'warning'
            })
            return
          }
        }
        if (this.eidtroomataForm.drinkingwaterisuse == true) {
          if (
            this.eidtroomataForm.drinkingwater == '' ||
            this.eidtroomataForm.drinkingwaternumber == ''
          ) {
            this.$message({
              message: '直饮水数据不合法',
              type: 'warning'
            })
            return
          }
        }
        if (this.eidtroomataForm.hairdryerisuse == true) {
          if (
            this.eidtroomataForm.hairdryer == '' ||
            this.eidtroomataForm.hairdryernumber == ''
          ) {
            this.$message({
              message: '电吹风数据不合法',
              type: 'warning'
            })
            return
          }
        }
        if (this.eidtroomataForm.voiperisuse == true) {
          if (
            this.eidtroomataForm.voiper == '' ||
            this.eidtroomataForm.voipernumber == ''
          ) {
            this.$message({
              message: '公话数据不合法',
              type: 'warning'
            })
            return
          }
        }
        if (this.eidtroomataForm.sendcardserisuse == true) {
          if (
            this.eidtroomataForm.sendcardser == '' ||
            this.eidtroomataForm.sendcardsernumber == ''
          ) {
            this.$message({
              message: '发卡机数据不合法',
              type: 'warning'
            })
            return
          }
        }
        if (
          this.eidtroomataForm.unsoldpkTerminalId !== '' ||
          this.eidtroomataForm.unsoldisuse
        ) {
          this.terminalRequests.push({
            isUse: this.eidtroomataForm.unsoldisuse == true ? 1 : 0,
            pkTerminalId: this.eidtroomataForm.unsoldpkTerminalId,
            terminalType: 26,
            terminalModel: this.eidtroomataForm.unsold,
            templateGuid: this.eidtroomataForm.unsoldtemplate,
            terminalCode: this.eidtroomataForm.unsoldnumber
          })
        }
        if (
          this.eidtroomataForm.drinkingwaterpkTerminalId !== '' ||
          this.eidtroomataForm.drinkingwaterisuse
        ) {
          this.terminalRequests.push({
            isUse: this.eidtroomataForm.drinkingwaterisuse == true ? 1 : 0,
            pkTerminalId: this.eidtroomataForm.drinkingwaterpkTerminalId,
            // terminalType: 27,
            terminalType: 6,
            terminalModel: this.eidtroomataForm.drinkingwater,
            templateGuid: this.eidtroomataForm.drinkingwatertemplate,
            terminalCode: this.eidtroomataForm.drinkingwaternumber
          })
        }
        if (
          this.eidtroomataForm.hairdryerpkTerminalId !== '' ||
          this.eidtroomataForm.hairdryerisuse
        ) {
          this.terminalRequests.push({
            isUse: this.eidtroomataForm.hairdryerisuse == true ? 1 : 0,
            pkTerminalId: this.eidtroomataForm.hairdryerpkTerminalId,
            terminalType: 28,
            terminalModel: this.eidtroomataForm.hairdryer,
            templateGuid: this.eidtroomataForm.hairdryertemplate,
            terminalCode: this.eidtroomataForm.hairdryernumber
          })
        }
        // 公话
        if (
          this.eidtroomataForm.voiperpkTerminalId !== '' ||
          this.eidtroomataForm.voiperisuse
        ) {
          this.terminalRequests.push({
            isUse: this.eidtroomataForm.voiperisuse == true ? 1 : 0,
            pkTerminalId: this.eidtroomataForm.voiperpkTerminalId,
            terminalType: 32,
            terminalModel: this.eidtroomataForm.voiper,
            templateGuid: this.eidtroomataForm.voipertemplate,
            terminalCode: this.eidtroomataForm.voipernumber
          })
        }
        // 发卡机
        if (
          this.eidtroomataForm.sendcardserpkTerminalId !== '' ||
          this.eidtroomataForm.sendcardserisuse
        ) {
          this.terminalRequests.push({
            isUse: this.eidtroomataForm.sendcardserisuse == true ? 1 : 0,
            pkTerminalId: this.eidtroomataForm.sendcardserpkTerminalId,
            terminalType: 32,
            terminalModel: this.eidtroomataForm.sendcardser,
            templateGuid: this.eidtroomataForm.sendcardsertemplate,
            terminalCode: this.eidtroomataForm.sendcardsernumber
          })
        }
      }
      console.log({
        areaGuid: this.areaGuid,
        buildingGuid: this.buildingGuid,
        controllerGuid:
          this.roomType == 2
            ? this.eidtroomataForm.acceWanguang
            : this.eidtroomataForm.wanguang.value,
        layers: this.layers,
        limitNum: this.roomType == 0 ? this.eidtroomataForm.limitNum : '',
        roomGuid: this.roomGuid,
        roomType: this.roomType,
        terminalRequests: this.terminalRequests,
        roomName: this.eidtroomataForm.roomName,
        unitGuid: this.unitGuid
      })
      this.$http({
        url: this.$http.adornUrl('/area/room/update-room-info'),
        method: 'post',
        data: this.$http.adornData({
          messageContent: {
            areaGuid: this.areaGuid,
            buildingGuid: this.buildingGuid,
            controllerGuid:
              this.roomType == 2
                ? this.eidtroomataForm.acceWanguang
                : this.eidtroomataForm.wanguang.value,
            layers: this.layers,
            limitNum: this.roomType == 0 ? this.eidtroomataForm.limitNum : '',
            roomGuid: this.roomGuid,
            roomType: this.roomType,
            terminalRequests: this.terminalRequests,
            roomName: this.eidtroomataForm.roomName,
            unitGuid: this.unitGuid
          },
          messageType: 0
        })
      }).then(({ data }) => {
        if (data.messageCode == 200) {
          this.$message({
            type: 'success',
            message: '编辑成功!',
            duration: 500,
            onClose: () => {
              this.$emit('eidtroomlist', this.layers)
            }
          })
          this.eidtroomDialogFormVisible = false
        } else {
          this.$message.error(data.errorMessage)
        }
      })
      // this.$refs['eidtroomataForm'].validate((valid) => {
      //     if(valid){

      //     }
      //  })
    },
    eidtifo(val) {
      // console.log(val)
      this.areaGuid = val
    },
    eidtroom(item, buldingname, buildingid, layers, buildingCode) {
      console.log(item)
      this.buildingCode = buildingCode
      // 房间号码
      this.roomNumber = item.roomCode
      this.roomType = item.roomType
      // this.eidtroomataForm.roomCode=item.roomCode
      // console.log(buldingname)
      this.eidtroomataForm.roomType = item.roomType
      this.eidtroomataForm.roomName = item.roomName
      this.buildingGuid = buildingid
      this.layers = layers
      this.roomGuid = item.roomGuid
      this.eidtroomataForm.roominfo =
        '楼栋' +
        buldingname +
        '\xa0\xa0\xa0\xa0\xa0\xa0' +
        '房间号' +
        item.roomCode
      this.eidtroomataForm.roomName = item.roomName
      this.getroomterminallsit()
      this.getwanguangoption()
      if (this.roomType == 0) {
        // 房间类型为 0 的，设备型号
        this.terminalselect('', this.roomEquipmentType)
        // this.terminalselect(22, this.doorlockmodeloption)
        // this.terminalselect(6, this.watercontroloption)
        // this.terminalselect(31, this.electroniccontrolopton)
        // this.terminalselect(24, this.airconditioningoption)
        // this.terminalselect(25, this.terminaloptions)

        // this.terminaltemplate(22, this.doorlocktemplateoption)
        // this.terminaltemplate(6, this.watertemplateoption)
        // this.terminaltemplate(31, this.electroniccontroltemplateoption)
        // this.terminaltemplate(24, this.airconditioningtemplateoption)
        // this.terminaltemplate(25, this.terminaltemplateoption)
      }
      if (this.roomType == 1 || this.roomType == 3) {
        this.terminalselect(1, this.consumptionoption)
        this.terminaltemplate(1, this.consumptiontemplateoption)
      }
      if (this.roomType == 2) {
        this.terminalselect(21, this.accesscontroloption)
        if (
          this.eidtroomataForm.accesscontrol == '13' ||
          this.eidtroomataForm.accesscontrol == '15'
        ) {
          this.terminaltemplate(21, this.accesscontroltemplateoption)
        } else {
          this.terminaltemplate(23, this.accesscontroltemplateoption)
        }
      }
      if (this.roomType == 4) {
        this.terminalselect(26, this.unsoldoptions)
        this.terminaltemplate(26, this.unsoldtemplateoption)
        // this.terminalselect(27, this.drinkingwateroptions);
        // this.terminaltemplate(27, this.drinkingwatertemplateoption);
        this.terminaltemplate(6, this.drinkingwatertemplateoption)
        this.terminalselect(28, this.hairdryeroption)
        this.terminaltemplate(28, this.hairdryertemplateoption)
        // 公话
        this.terminalselect(32, this.voiperoption)
        this.terminaltemplate(32, this.voipertemplateoption)
        // 发卡机
        this.terminalselect(29, this.sendcardseroption)
        this.terminaltemplate(29, this.sendcardsertemplateoption)
      }
      setTimeout(() => {
        this.eidtroomDialogFormVisible = true
      }, 100)
    },
    //获取房间设备详情
    getroomterminallsit() {
      this.$http({
        url: this.$http.adornUrl('/area/room/room-terminal-details'),
        method: 'post',
        data: this.$http.adornData({
          messageContent: {
            roomGuid: this.roomGuid,
            unitGuid: this.unitGuid,
            roomType: 0
          },
          messageType: 0
        })
      }).then(({ data }) => {
        if (data.messageCode == 200) {
          console.log(data)
          // this.$set(this.eidtroomataForm.wanguang,'value',data.messageContent.controllerGuid)
          this.eidtroomataForm.wanguang = {
            label: data.messageContent.controllerName,
            value: data.messageContent.controllerGuid,
            controllerModel: data.messageContent.controllerModel
          }
          // 初始化
          this.wanguangChange(this.eidtroomataForm.wanguang)

          // this.eidtroomataForm.wanguang.value = data.messageContent.controllerGuid;
          // 最大可住人数
          this.eidtroomataForm.limitNum = data.messageContent.limitNum
          this.eidtroomataForm.doorlockmodel = ''
          this.eidtroomataForm.doorlocknumber = ''
          this.eidtroomataForm.doorpkTerminalId = ''
          this.eidtroomataForm.doorlockisuse = false
          this.eidtroomataForm.doorlocktemplate = ''
          this.eidtroomataForm.airconditioningpkTerminalId = ''
          this.eidtroomataForm.airconditioning = ''
          this.eidtroomataForm.airconditioningnumber = ''
          this.eidtroomataForm.airconditioningtemplate = ''
          this.eidtroomataForm.airconditioningisuse = false
          this.eidtroomataForm.waterpkTerminalId = ''
          this.eidtroomataForm.watercontrol = ''
          this.eidtroomataForm.waternumber = ''
          this.eidtroomataForm.watertemplate = ''
          this.eidtroomataForm.watercontrolisuse = false
          this.eidtroomataForm.electroniccontrol = ''
          this.eidtroomataForm.electroniccontrolnumber = ''
          this.eidtroomataForm.electroniccontrolpkTerminalId = ''
          this.eidtroomataForm.electroniccontrolisuse = false
          this.eidtroomataForm.electroniccontroltemplate = ''
          this.eidtroomataForm.terminal = ''
          this.eidtroomataForm.terminalnumber = ''
          this.eidtroomataForm.terminalpkTerminalId = ''
          this.eidtroomataForm.terminalisuse = false
          this.eidtroomataForm.terminaltemplate = ''
          this.eidtroomataForm.unsold = ''
          this.eidtroomataForm.unsoldnumber = ''
          this.eidtroomataForm.unsoldpkTerminalId = ''
          this.eidtroomataForm.unsoldisuse = false
          this.eidtroomataForm.unsoldtemplate = ''
          this.eidtroomataForm.drinkingwater = ''
          this.eidtroomataForm.drinkingwaternumber = ''
          this.eidtroomataForm.drinkingwaterpkTerminalId = ''
          this.eidtroomataForm.drinkingwaterisuse = false
          this.eidtroomataForm.drinkingwatertemplate = ''
          this.eidtroomataForm.hairdryer = ''
          this.eidtroomataForm.hairdryernumber = ''
          this.eidtroomataForm.hairdryerpkTerminalId = ''
          this.eidtroomataForm.hairdryerisuse = false
          this.eidtroomataForm.hairdryertemplate = ''
          this.eidtroomataForm.consumptionpkTerminalId = ''
          this.eidtroomataForm.consumption = ''
          this.eidtroomataForm.consumptionnumber = ''
          this.eidtroomataForm.consumptiontemplate = ''
          this.eidtroomataForm.consumptionisuse = false
          // 充值机
          this.eidtroomataForm.rechargepkTerminalId = ''
          this.eidtroomataForm.recharge = ''
          this.eidtroomataForm.rechargenumber = ''
          this.eidtroomataForm.rechargetemplate = ''
          this.eidtroomataForm.rechargeisuse = false
          // 圈存机
          this.eidtroomataForm.circlingpkTerminalId = ''
          this.eidtroomataForm.circling = ''
          this.eidtroomataForm.circlingnumber = ''
          this.eidtroomataForm.circlingtemplate = ''
          this.eidtroomataForm.circlingisuse = false

          this.eidtroomataForm.accesscontrolpkTerminalId = ''
          this.eidtroomataForm.accesscontrol = ''
          this.eidtroomataForm.accesscontrolnumber = ''
          this.eidtroomataForm.accesscontrolemplate = ''
          this.eidtroomataForm.accesscontrolisuse = false
          // 房间独立处理
          if (this.eidtroomataForm.roomType == 0) {
            this.eidtroomataForm.terminalRequests =
              data.messageContent.terminalRequests || []
          }
          for (
            var i = 0;
            i < data.messageContent.terminalRequests.length;
            i++
          ) {
            if (data.messageContent.terminalRequests[i].terminalType == 22) {
              this.eidtroomataForm.doorlockmodel =
                data.messageContent.terminalRequests[i].terminalModel
              this.handleDoor(this.eidtroomataForm.doorlockmodel, false)
              //  名单格式
              this.eidtroomataForm.nameListType =
                data.messageContent.terminalRequests[i].nameListType

              this.eidtroomataForm.doorlocknumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.doorpkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.doorlockisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
              this.eidtroomataForm.doorlocktemplate =
                data.messageContent.terminalRequests[i].templateGuid
            }
            if (data.messageContent.terminalRequests[i].terminalType == 24) {
              this.eidtroomataForm.airconditioningpkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.airconditioning =
                data.messageContent.terminalRequests[i].terminalModel
              this.eidtroomataForm.airconditioningnumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.airconditioningtemplate =
                data.messageContent.terminalRequests[i].templateGuid
              this.eidtroomataForm.airconditioningisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
            }
            if (data.messageContent.terminalRequests[i].terminalType == 6) {
              this.eidtroomataForm.waterpkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.watercontrol =
                data.messageContent.terminalRequests[i].terminalModel
              this.eidtroomataForm.waternumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.watertemplate =
                data.messageContent.terminalRequests[i].templateGuid
              this.eidtroomataForm.watercontrolisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
            }
            if (data.messageContent.terminalRequests[i].terminalType == 31) {
              this.eidtroomataForm.electroniccontrol =
                data.messageContent.terminalRequests[i].terminalModel
              this.eidtroomataForm.electroniccontrolnumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.electroniccontrolpkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.electroniccontrolisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
              this.eidtroomataForm.electroniccontroltemplate =
                data.messageContent.terminalRequests[i].templateGuid
            }
            if (data.messageContent.terminalRequests[i].terminalType == 25) {
              this.eidtroomataForm.terminal =
                data.messageContent.terminalRequests[i].terminalModel
              this.eidtroomataForm.terminalnumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.terminalpkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.terminalisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
              this.eidtroomataForm.terminaltemplate =
                data.messageContent.terminalRequests[i].templateGuid
            }
            if (data.messageContent.terminalRequests[i].terminalType == 26) {
              this.eidtroomataForm.unsold =
                data.messageContent.terminalRequests[i].terminalModel
              this.eidtroomataForm.unsoldnumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.unsoldpkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.unsoldisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
              this.eidtroomataForm.unsoldtemplate =
                data.messageContent.terminalRequests[i].templateGuid
            }
            // if (data.messageContent.terminalRequests[i].terminalType == 27) {
            if (data.messageContent.terminalRequests[i].terminalType == 6) {
              this.eidtroomataForm.drinkingwater =
                data.messageContent.terminalRequests[i].terminalModel
              this.eidtroomataForm.drinkingwaternumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.drinkingwaterpkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.drinkingwaterisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
              this.eidtroomataForm.drinkingwatertemplate =
                data.messageContent.terminalRequests[i].templateGuid
            }
            if (data.messageContent.terminalRequests[i].terminalType == 28) {
              this.eidtroomataForm.hairdryer =
                data.messageContent.terminalRequests[i].terminalModel
              this.eidtroomataForm.hairdryernumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.hairdryerpkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.hairdryerisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
              this.eidtroomataForm.hairdryertemplate =
                data.messageContent.terminalRequests[i].templateGuid
            }
            if (data.messageContent.terminalRequests[i].terminalType == 1) {
              this.eidtroomataForm.consumptionpkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.consumption =
                data.messageContent.terminalRequests[i].terminalModel
              this.eidtroomataForm.consumptionnumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.consumptiontemplate =
                data.messageContent.terminalRequests[i].templateGuid
              this.eidtroomataForm.consumptionisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
            }
            // 充值机
            if (data.messageContent.terminalRequests[i].terminalType == 2) {
              this.eidtroomataForm.rechargepkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.recharge =
                data.messageContent.terminalRequests[i].terminalModel
              this.eidtroomataForm.rechargenumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.rechargetemplate =
                data.messageContent.terminalRequests[i].templateGuid
              this.eidtroomataForm.rechargeisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
            }
            // 圈存
            if (data.messageContent.terminalRequests[i].terminalType == 33) {
              this.eidtroomataForm.circlingpkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.circling =
                data.messageContent.terminalRequests[i].terminalModel
              this.eidtroomataForm.circlingnumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.circlingtemplate =
                data.messageContent.terminalRequests[i].templateGuid
              this.eidtroomataForm.circlingisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
            }
            console.log(this.eidtroomataForm.rechargeisuse)
            if (data.messageContent.terminalRequests[i].terminalType == 21) {
              this.eidtroomataForm.accesscontrolpkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.accesscontrol =
                data.messageContent.terminalRequests[i].terminalModel
              this.eidtroomataForm.accesscontrolnumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.accesscontrolemplate =
                data.messageContent.terminalRequests[i].templateGuid

              this.eidtroomataForm.accesscontrolisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
              // 端口、ip
              this.eidtroomataForm.ip =
                data.messageContent.terminalRequests[i].ip
              this.eidtroomataForm.port =
                data.messageContent.terminalRequests[i].port

              // 门编号
              this.$set(
                this.eidtroomataForm,
                'doorCode',
                data.messageContent.terminalRequests[i].doorCode
              )
              // 进出方向
              this.$set(
                this.eidtroomataForm,
                'openType',
                data.messageContent.terminalRequests[i].openType
              )
              // 人脸ip
              this.$set(
                this.eidtroomataForm,
                'doorFaceIp',
                data.messageContent.terminalRequests[i].doorFaceIp
              )
              /**
               * 新门禁网关
               */
              this.getAceeWangguan(this.eidtroomataForm.accesscontrol)
              this.$nextTick(() => {
                this.$set(
                  this.eidtroomataForm,
                  'acceWanguang',
                  data.messageContent.controllerGuid
                )
              })
            }
            if (data.messageContent.terminalRequests[i].terminalType == 32) {
              this.eidtroomataForm.voiper =
                data.messageContent.terminalRequests[i].terminalModel
              this.eidtroomataForm.voipernumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.voiperpkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.voiperisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
              this.eidtroomataForm.voipertemplate =
                data.messageContent.terminalRequests[i].templateGuid
            }
            if (data.messageContent.terminalRequests[i].terminalType == 29) {
              this.eidtroomataForm.sendcardser =
                data.messageContent.terminalRequests[i].terminalModel
              this.eidtroomataForm.sendcardsernumber =
                data.messageContent.terminalRequests[i].terminalCode
              this.eidtroomataForm.sendcardserpkTerminalId =
                data.messageContent.terminalRequests[i].pkTerminalId
              this.eidtroomataForm.sendcardserisuse =
                data.messageContent.terminalRequests[i].isUse == 1
                  ? true
                  : false
              this.eidtroomataForm.sendcardsertemplate =
                data.messageContent.terminalRequests[i].templateGuid
            }
          }
        } else {
          this.$message.error(data.errorMessage)
        }
      })
    },

    // 根据类型去分类,网关显示
    getInfo(arr) {
      this.wanguangoption = []
      // 网关
      arr.map(item => {
        if (this.roomType == 0) {
          // 房间
          if (
            item.controllerModel == 91 ||
            item.controllerModel == 92 ||
            item.controllerModel == 93 ||
            item.controllerModel == 95 ||
            item.controllerModel == 96 ||
            item.controllerModel == 97 ||
            item.controllerModel == 98
          ) {
            this.wanguangoption.push({
              label: item.controllerName,
              value: item.controllerGuid,
              controllerModel: item.controllerModel
            })
          }
        }
        // 食堂、小卖铺
        if (this.roomType == 1 || this.roomType == 3 || this.roomType == 4) {
          if (
            item.controllerModel == 91 ||
            item.controllerModel == 92 ||
            item.controllerModel == 96 ||
            item.controllerModel == 98
          ) {
            this.wanguangoption.push({
              label: item.controllerName,
              value: item.controllerGuid,
              controllerModel: item.controllerModel
            })
          }
        }
      })
    },
    // 获取网关
    getwanguangoption() {
      this.wanguangoption = []
      this.$http({
        url: this.$http.adornUrl('/api/v1/device/controller-pithy'),
        method: 'post',
        data: this.$http.adornData({
          messageContent: {
            buildingGuid: this.buildingGuid,
            layer: this.layers
          },
          messageType: 0
        })
      }).then(({ data }) => {
        if (data.messageCode == 200) {
          console.log(data)
          let arr = data.messageContent
          this.getInfo(arr)
          // for (var i = 0; i < arr.length; i++) {
          //   let newobj = {
          //     label: arr[i].controllerName,
          //     value: arr[i].controllerGuid,
          //     controllerModel: arr[i].controllerModel,
          //   };
          //   this.wanguangoption.push(newobj);
          // }
        } else {
          this.$message.error(data.errorMessage)
        }
      })
    },
    // 获取设备
    terminalselect(type, terminaloption) {
      this.$http({
        url: this.$http.adornUrl('/terminal/terminal-model-select'),
        method: 'post',
        data: this.$http.adornData({
          messageContent: {
            terminalType: type,
            unitGuid: this.unitGuid
          },
          messageType: 0
        })
      }).then(({ data }) => {
        console.log(data)
        if (data.messageCode == 200) {
          let Arr = data.messageContent
          if (terminaloption.length == 0) {
            for (var i = 0; i < Arr.length; i++) {
              var itemObj = {
                label: Arr[i].modelName,
                value: Arr[i].modelId,
                type: type
              }
              terminaloption.push(itemObj)
            }
            console.log(terminaloption)
          }
        } else {
          this.$message.error(data.errorMessage)
        }
      })
    },
    //获取设备模板
    terminaltemplate(type, templateoption) {
      this.$http({
        url: this.$http.adornUrl('/terminal/template-model-select'),
        method: 'post',
        data: this.$http.adornData({
          messageContent: {
            terminalType: type,
            unitGuid: this.unitGuid
          },
          messageType: 0
        })
      }).then(({ data }) => {
        console.log(data)
        if (data.messageCode == 200) {
          let Arr = data.messageContent
          if (templateoption.length == 0) {
            for (var i = 0; i < Arr.length; i++) {
              var itemObj = {
                label: Arr[i].templateName,
                value: Arr[i].templateGuid,
                type: type
              }
              templateoption.push(itemObj)
            }
            // console.log(templateoption)
          } else {
            if (this.roomType == 2) {
              templateoption = []
              for (var i = 0; i < Arr.length; i++) {
                var itemObj = {
                  label: Arr[i].templateName,
                  value: Arr[i].templateGuid,
                  type: type
                }
                templateoption.push(itemObj)
                this.accesscontroltemplateoption = templateoption
              }
            }
          }
        } else {
          this.$message.error(data.errorMessage)
        }
      })
    },
    /**
     * 房间编辑设备
     */
    /**
     * 获取房间设备信息
     */
    getRoomT() {
      this.$http({
        url: this.$http.adornUrl('/area/room/room-terminal-details-search'),
        method: 'post',
        data: this.$http.adornData({
          messageContent: {
            roomGuid: this.roomGuid,
            roomType: 0,
            unitGuid: this.unitGuid
          },
          messageType: 0
        })
      }).then(({ data }) => {
        console.log(data)
        if (data.messageCode == 200) {
          // 房间独立处理
          this.eidtroomataForm.terminalRequests = data.messageContent || []
          this.$emit('eidtroomlist', this.layers)
        } else {
          this.$message.error(data.errorMessage)
        }
      })
    },
    // 删除设备
    deleteT(row) {
      this.$http({
        url: this.$http.adornUrl('/terminal/delete-terminal'),
        method: 'post',
        data: this.$http.adornData({
          messageContent: {
            terminalGuid: row.terminalGuid,
            terminalType: row.terminalType,
            unitGuid: this.unitGuid
          },
          messageType: 0
        })
      }).then(({ data }) => {
        console.log(data)
        if (data.messageCode == 200) {
          this.$message.error('删除成功')
          // 刷新
          this.getRoomT()
          this.editcloseDialog()
        } else {
          this.$message.error(data.errorMessage)
        }
      })
    },
    // 获取类型，并且获取设备型号，设备参数模板
    editTSelect(type) {
      console.log(this.editTForm.wanguang.controllerModel, type)
      this.templateGuidOpiton = []
      // 获取设备型号
      this.editWangChange(this.editTForm.wanguang, type)
      if (type != '') {
        // 获取参数模板
        this.terminaltemplate(type, this.templateGuidOpiton)
      }
    },
    // 房间类型的网关处理
    editWangChange(val, type) {
      this.editTForm.templateGuid = ''
      // MC3611	91	MC3612	92 CT1601	93 CT1612	95	MC3622	96	MC3632	98
      if (val.controllerModel == 91 || val.controllerModel == 92) {
        if (type == 22) {
          // 门锁
          this.terminalModelOpiton = [
            { value: 43, label: 'EL200CW' },
            { value: 45, label: 'EL150CW' },
            { value: 48, label: 'EL300CW' },
            { value: 49, label: 'EL180CW' }
          ]
        }
        if (type == 6) {
          // 水控
          this.terminalModelOpiton = [
            { value: 32, label: 'F300CW' },
            { value: 50, label: 'F500CW' },
            { value: 51, label: 'F600CW' }
          ]
        }

        if (type == 31) {
          this.terminalModelOpiton = []
        }
      } else if (val.controllerModel == 96) {
        if (type == 22) {
          // 门锁
          this.terminalModelOpiton = [
            { value: 43, label: 'EL200CW' },
            { value: 45, label: 'EL150CW' },
            { value: 48, label: 'EL300CW' },
            { value: 49, label: 'EL180CW' }
          ]
        }
        if (type == 6) {
          // 水控
          this.terminalModelOpiton = [
            { value: 56, label: 'F562CW' },
            { value: 59, label: 'F662CW' }
          ]
        }
        if (type == 31) {
          // 电控
          this.terminalModelOpiton = []
        }
      } else if (val.controllerModel == 93 || val.controllerModel == 95) {
        if (type == 22) {
          // 门锁
          this.terminalModelOpiton = [
            { value: 46, label: 'EL150C-A' },
            { value: 47, label: 'EL150C-B' }
          ]
        }
        if (type == 6) {
          this.terminalModelOpiton = []
        }
        if (type == 31) {
          this.terminalModelOpiton = []
        }
      } else if (val.controllerModel == 97) {
        if (type == 22) {
          this.terminalModelOpiton = []
        }
        if (type == 6) {
          this.terminalModelOpiton = []
        }
        if (type == 31) {
          // 电控
          this.terminalModelOpiton = [{ value: 71, label: 'EC100' }]
        }
      } else if (val.controllerModel == 98) {
        if (type == 22) {
          // 门锁
          this.terminalModelOpiton = [
            { value: 43, label: 'EL200CW' },
            { value: 45, label: 'EL150CW' },
            { value: 46, label: 'EL150C-A' },
            { value: 47, label: 'EL150C-B' },
            { value: 48, label: 'EL300CW' },
            { value: 49, label: 'EL180CW' }
          ]
        }
        if (type == 6) {
          // 水控
          this.terminalModelOpiton = [
            { value: 56, label: 'F562CW' },
            { value: 59, label: 'F662CW' }
          ]
        }
        if (type == 31) {
          // 电控
          this.terminalModelOpiton = []
        }
      } else {
        if (type == 22) {
          // 门锁
          this.terminalModelOpiton = [
            { value: 43, label: 'EL200CW' },
            { value: 45, label: 'EL150CW' },
            { value: 46, label: 'EL150C-A' },
            { value: 47, label: 'EL150C-B' },
            { value: 48, label: 'EL300CW' },
            { value: 49, label: 'EL180CW' }
          ]
        }
        if (type == 6) {
          // 水控
          this.terminalModelOpiton = [
            { value: 32, label: 'F300CW' },
            { value: 50, label: 'F500CW' },
            { value: 51, label: 'F600CW' },
            { value: 56, label: 'F562CW' },
            { value: 59, label: 'F662CW' }
          ]
        }
        if (type == 31) {
          // 电控
          this.terminalModelOpiton = [{ value: 71, label: 'EC100' }]
        }
        // 空调
        if (type == 24) {
          this.terminalModelOpiton = [{ value: 125, label: 'KongTiao' }]
        }
        // // 归宿终端
        if (type == 25) {
          this.terminalModelOpiton = [{ value: 130, label: 'GuiSuZhongDuan' }]
        }
      }
    },
    // 打开弹出
    editDialog(row) {
      /** */
      // 初始化数据
      this.editTForm.controllerGuid = ''
      this.editTVisible = true
      // 修改设备
      if (row.terminalModel) {
        this.editTTitle = '修改设备'
        let wanguang = {
          controllerModel: row.controllerModel,
          label: row.controllerName,
          value: row.controllerGuid
        }
        this.editTForm = { ...row, isUse: row.isUse == 1 }
        this.$set(this.editTForm, 'wanguang', wanguang)
        // 获取类型，并且获取设备型号，设备参数模板
        this.editTSelect(row.terminalType)
        this.editTForm.templateGuid = row.templateGuid
      } else {
        this.editTTitle = '新增设备'
        this.editTForm.wanguang = JSON.parse(
          JSON.stringify(this.eidtroomataForm.wanguang)
        ) || {
          controllerModel: '',
          label: '',
          value: ''
        }
      }
    },
    // 关闭弹窗
    editcloseDialog(done) {
      // if (this.$refs['eidtroomataForm']!==undefined) {
      //   this.$refs['eidtroomataForm'].resetFields()
      // }
      /**
       * 初始化
       */
      this.editTForm = {
        // 设备类型
        terminalType: '',
        // 设备id
        terminalGuid: '',
        // 设备型号
        terminalModel: '',
        // 参数模板id
        templateGuid: '',
        wanguang: '',
        addNumber: 1,
        nameListType: '',
        isUse: true
      }
      this.editTForm.wanguang = {
        controllerModel: '',
        label: '',
        value: ''
      }
      // 设备型号
      this.terminalModelOpiton = []
      // 参数模板
      this.templateGuidOpiton = []
      this.editTVisible = false

      // done()
    },
    // 提交
    addFormSubmit() {
      let messageContent = {
        addNumber: this.editTForm.addNumber,
        controllerGuid: this.editTForm.wanguang.value,
        isUse: this.editTForm.isUse ? 1 : 0,
        nameListType: this.editTForm.nameListType,
        // 参数模板gid
        templateGuid: this.editTForm.templateGuid,
        // 设备型号
        terminalModel: this.editTForm.terminalModel,
        // 设备类型
        terminalType: this.editTForm.terminalType,
        unitGuid: this.unitGuid,
        roomGuid: this.roomGuid
        // terminalGuid: 'string',
      }
      console.log(messageContent)
      this.$http({
        url: this.$http.adornUrl('/area/room/room-info-add-terminal'),
        method: 'post',
        data: this.$http.adornData({
          messageContent: messageContent,
          messageType: 0
        })
      }).then(({ data }) => {
        console.log(data)
        if (data.messageCode == 200) {
          this.editcloseDialog()
          // 刷新
          this.getRoomT()
          this.$message({
            type: 'success',
            message: '新增成功'
          })
        } else {
          this.$message.error(data.errorMessage)
        }
      })
    },
    eidtFormSubmit() {
      if (this.editTForm.terminalName == '') {
        this.$message.error('设备名称不能为空')
        return
      }
      if (this.editTForm.terminalCode == '') {
        this.$message.error('设备编号不能为空')
        return
      }
      let messageContent = {
        // addNumber: this.editTForm.addNumber,
        controllerGuid: this.editTForm.wanguang.value || '',
        isUse: this.editTForm.isUse ? 1 : 0,
        nameListType: this.editTForm.nameListType,
        // 参数模板gid
        templateGuid: this.editTForm.templateGuid,
        // 设备型号
        terminalModel: this.editTForm.terminalModel,
        // 设备类型
        terminalType: this.editTForm.terminalType,
        unitGuid: this.unitGuid,
        roomGuid: this.roomGuid,
        terminalGuid: this.editTForm.terminalGuid,
        terminalCode: this.editTForm.terminalCode,
        terminalName: this.editTForm.terminalName
      }
      console.log(messageContent)
      this.$http({
        url: this.$http.adornUrl('/area/room/room-info-update-terminal'),
        method: 'post',
        data: this.$http.adornData({
          messageContent: messageContent,
          messageType: 0
        })
      }).then(({ data }) => {
        console.log(data)
        if (data.messageCode == 200) {
          this.editcloseDialog()
          // 刷新
          this.getRoomT()
          this.$message({
            type: 'success',
            message: '修改成功'
          })
        } else {
          this.$message.error(data.errorMessage)
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
/deep/.el-dialog__wrapper .el-dialog.el-dialog--center.edit {
  .el-dialog__body {
    padding-bottom: 0;
    padding-top: 10px;
  }
}

.el-form-item {
  margin-bottom: 12px;
}
.area_eidt_room {
  /deep/.el-dialog--center .el-dialog__body {
    padding: 10px 25px;
  }

  //滚动条的宽度
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  //滚动条的滑块
  ::-webkit-scrollbar-thumb {
    background-color: #a1a3a9;
    border-radius: 3px;
  }

  .el-form-item {
    margin-bottom: 5px;
  }
  .loudonginfo {
    font-size: 14px;
    // font-weight: bolder;
    padding-left: 10px;
    color: #303133;
    .loudong_name {
      margin-right: 20px;
    }
  }
  .check {
    border-top: 1px solid #e5e9f2;
    display: flex;
    justify-content: space-between;
    flex-flow: wrap;
    // height: 400px;
    overflow-y: auto;
  }
  .box-card {
    margin-top: 20px;
    padding-top: 10px;
    padding-left: 10px;
  }
}
</style>